;; (defun util/add-to-load-path (name)
;;   (let ((default-directory plugins-dir))
;;     (normal-top-level-add-to-load-path '(name))
;;     (normal-top-level-add-subdirs-to-load-path)))
  
(defun util/get-from-svn (name url)
  (let ((cmd (concat
	      "svn checkout " url " " plugins-dir name)))
    (message "Checkout from svn...")
    (shell-command cmd "*checkout*")))

(defun util/get-from-git (name url)
  (let ((cmd (concat
	      "git clone " url " " plugins-dir name)))
    (shell-command cmd)))

(defun util/download-file-from-url (url &optional download-dir download-name)
  "download file from url"
  (require 'url)
  (interactive)
  (let ((url (or url
                 (read-string "Enter download URL: "))))
    (let ((download-buffer (url-retrieve-synchronously url)))
      (save-excursion
        (set-buffer download-buffer)
        ;; we may have to trim the http response
        (goto-char (point-min))
        (re-search-forward "^$" nil 'move)
        (forward-char)
        (delete-region (point-min) (point))
        (write-file (concat (or download-dir
                                "~/downloads/")
                            (or download-name
                                (car (last (split-string url "/" t))))))))))

(provide 'utils)
